package com.jie.deletefile.Gestures;

import android.util.Log;

import java.util.List;

/**
 * Created by 13952137957 on 2016/11/16.
 */

public class DataUtils {
    /**
     * Integer数组转换成string
     * @param integers
     * @return
     */
    public static String intToString(Integer[] integers) {
        String s = new String();
        for (int i : integers) {
            String s1 = Integer.toString(i);
            s += s1;
        }
        return s;
    }


    /**
     * list<Intenger>数据转换成Integer数组
     * @param data
     * @return
     */
    public static Integer[] list2integer(List<Integer> data) {
        Integer[] integer = new Integer[data.size()];
        for (int i = 0; i < data.size(); i++) {
            integer[i] = data.get(i);
        }

        return integer;
    }


    public static Integer[] string2integer(String data) {
        data = data.trim();
        Log.e("TAG", "string2integer: data="+data );
        Integer[] integers = new Integer[data.length()];
        for (int i = 0; i < data.length(); i++) {
            char c = data.charAt(i);
            int i1 = Integer.parseInt(String.valueOf(c));
            integers[i] = i1;
        }
        return integers;
    }
}
